package cc.vv.btpartyjob.partymanager.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;

import cc.vv.baselibrary.adapter.LKBaseAdapter;
import cc.vv.btpartyjob.jnimodule.server.OperationServer;
import cc.vv.btpartyjob.partymanager.R;
import cc.vv.btpartyjob.partymanager.moudel.bean.SocialOrginBean;
import cc.vv.party.beans.vo.SocietyOrgVO;

/**
 * 社会组织adapter
 * Created by Chen.qi on 2018/10/25.
 */
public class SocialOrganAdapter extends LKBaseAdapter<SocietyOrgVO> {

    public SocialOrganAdapter(ArrayList<SocietyOrgVO> objList, Activity activity) {
        super(objList, activity);
    }

    @Override
    protected View lpgetView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(mActivity, R.layout.item_social_organization, null);
            viewHolder.tv_name = convertView.findViewById(R.id.tv_iso_socialOrganName);
            viewHolder.tv_time = convertView.findViewById(R.id.tv_iso_socialTime);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        if (mObjList != null) {
            SocietyOrgVO socialOrginBean = mObjList.get(position);
            viewHolder.tv_name.setText(socialOrginBean.getOrgName());
            viewHolder.tv_time.setText(OperationServer.INSTANCE.formatStr(socialOrginBean.getPrincipal()));
        }
        return convertView;
    }

    class ViewHolder {
        /**
         * 组织名称
         */
        private TextView tv_name;
        /**
         * 时间
         */
        private TextView tv_time;
    }
}
